package com.example.ass7.level;

import java.awt.Color;
import java.util.ArrayList;
import java.util.List;

import com.example.ass7.geometryprimitives.Point;
import com.example.ass7.sprite.Block;
import com.example.ass7.sprite.Formation;
import com.example.ass7.sprite.Sprite;

/**
 * @author Meirav Ben Izhak
 */
public class DataLevel implements LevelInformation {

    private String levelName;
    private int paddleSpeed;
    private int paddleWidth;
    private int rowHeight;
    private Point centerBlock;
    private Sprite background;
    private final List<Block> blocks;

    /**
     * constructor.
     */
    public DataLevel() {
        this.blocks = new ArrayList<Block>();
    }

    @Override
    public int paddleSpeed() {
        return this.paddleSpeed;
    }

    @Override
    public int paddleWidth() {
        return this.paddleWidth;
    }

    @Override
    public String levelName() {
        return this.levelName;
    }

    @Override
    public Sprite getBackground() {
        return this.background;
    }

    @Override
    public List<Block> blocks() {
        return this.blocks;
    }

    @Override
    public int numberOfBlocksToRemove() {
        return this.blocks.size();
    }

    @Override
    public Formation formation() {
        return new Formation();
    }

    /**
     * @return the Color it drew.
     */
    public Color drawRandomColor() {
        java.util.Random rand = new java.util.Random();
        float red = rand.nextFloat();
        float green = rand.nextFloat();
        float blue = rand.nextFloat();
        Color randomColor = new Color(red, green, blue);
        return randomColor;
    }

    /**
     * @return String
     */
    public String getLevelName() {
        return this.levelName;
    }

    /**
     * @param pLevelName
     *            pLevelName
     */
    public void setLevelName(String pLevelName) {
        this.levelName = pLevelName;
    }

    /**
     * @return int
     */
    public int getPaddleSpeed() {
        return this.paddleSpeed;
    }

    /**
     * @param pPaddleSpeed
     *            void
     */
    public void setPaddleSpeed(int pPaddleSpeed) {
        this.paddleSpeed = pPaddleSpeed;
    }

    /**
     * @return int
     */
    public int getPaddleWidth() {
        return this.paddleWidth;
    }

    /**
     * @param pPaddleWidth
     *            paddleWidth
     */
    public void setPaddleWidth(int pPaddleWidth) {
        this.paddleWidth = pPaddleWidth;
    }

    /**
     * @return Point
     */
    public Point getCenterBlock() {
        return this.centerBlock;
    }

    /**
     * @param pCenterBlock
     *            centerBlock
     */
    public void setCenterBlock(Point pCenterBlock) {
        this.centerBlock = pCenterBlock;
    }

    /**
     * @return int
     */
    public int getRowHeight() {
        return this.rowHeight;
    }

    /**
     * @param pRowHeight
     *            rowHeight
     */
    public void setRowHeight(int pRowHeight) {
        this.rowHeight = pRowHeight;
    }

    /**
     * @param pBlock
     *            pBlock
     */
    public void addBlock(Block pBlock) {
        this.blocks.add(pBlock);
    }

    /**
     * @param pBackground
     *            background
     */
    public void setBackground(Sprite pBackground) {
        this.background = pBackground;
    }

}
